/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MyClass;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

/**
 *
 * @author HuuTai_it
 */  
public class HighScores extends Canvas{ 
    
    private Control control;
    private Image highScores = Image.createImage("/MyPicture/highscoresscreen.png");
    private int[] scores = new int[5];
    
    public HighScores(Control control) throws Exception {
        
        this.control = control;
        setFullScreenMode(true);
        HighScoresSave hss = new HighScoresSave();
        scores = hss.getHighScores();
    }
    
    public void paint(Graphics g) {

        g.drawImage(highScores, 0, 0,  Graphics.TOP | Graphics.LEFT);
        
        g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_LARGE));
        
        g.setColor(255, 255, 255);
        
        for(int i = 0; i < 5; i++)
            g.drawString(String.valueOf(scores[i]), 170, 130 + 25 * i, g.TOP | g.HCENTER);
    }
    
    public void keyPressed(int keyCode) {
        
        switch(getGameAction(keyCode)) {
                
            case FIRE:
                control.select();
                control.showMainMenu();
                break;
        }        
    }    
}  